define([
	'jquery',
	'underscore',
	'backbone',
], function($, _, Backbone,bootstrap) {
	var View = Backbone.View.extend({
		initialize: function(opt) {
			// console.log('receive init opt=', opt);
			this.options = opt;
		},

		// life-cycle hook method
		render: function(cb) {
			if (!$(this.el).is(":visible")) // if hide then show
				this.show();
			cb && cb(null); // err, data
		},

		// when a new layer add, hide previous view
		hide: function() {
			$(this.el).hide();
		},

		// when back, show previous view
		show: function() {
			$(this.el).show();
		},

		// fresh data
		refresh: function(cb) {
			this.render(cb);
		},

		// when back, remove top view
		remove: function(opt) {
			if (opt && opt.keepEvent) // only remove view
				return $(this.el).detach();
			$(this.el).remove();
		}
	});
	View.extend = Backbone.View.extend;
	return View;
});